<?php
$path = Router::url(array('controller' => '/', 'action' =>''), true);
$cuser = $session->read('User');
$userid = base64_encode($cuser["id"]);
$controller = $this->name; 
$actions = $this->action; 

$objmenu = $action->getnavigation($controller,$actions);
$listpage = array("Users","Searchs","Reports","Types","Projects");

//cid是企业编号cgid是高校编号
if((@$cuser['cid'] || @$cuser['cgid']) && in_array($controller, $listpage)){
    //重定向浏览器   
    header("Location: ".$path);   
    //确保重定向后，后续代码不会被执行   
    exit; 
}
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="bookmark" type="image/x-icon" href="<?php echo $path;?>favicon.ico"/> 
<link rel="shortcut icon" href="<?php echo $path;?>favicon.ico"/>
<link rel="icon" type="image/x-png" href="<?php echo $path;?>favicon.png"/>
<?php echo $html->charset('utf-8') ?>
<?php echo $html->css('common.css'); ?>
<?php echo $html->css('msg.css'); ?>
<?php echo $html->css('jquery-ui-1.8.18.custom.css'); ?>
<?php echo $html->css('jquery.jscrollpane.css'); ?>
<?php echo $html->css('uniform.default.css'); ?>



<?php 
if($this->action=="companyperson" || $this->action=="colleageperson" ){
    echo $javascript->link('jquery-1.4.3.min.js');
}else{
    echo $javascript->link('jquery-1.6.2.js');
    //echo $javascript->link('jquery-1.4.3.min.js');
}?>


<?php echo $javascript->link('My97DatePicker/WdatePicker.js');?>
<?php echo $javascript->link('jquery-ui-1.8.18.custom.min.js');?>
<?php echo $javascript->link('message.js');?>
<?php echo $javascript->link('jquery.mousewheel.js');?>
<?php echo $javascript->link('jquery.jscrollpane.min.js');?>
<?php echo $javascript->link('jquery.uniform.js');?>
<?php echo $javascript->link('jquery.form.js');?>
<?php echo $javascript->link('check.js');?>
<?php echo $javascript->link('placeholder.js');?>
<?php echo $javascript->link('common.js');?>





<script type="text/javascript">
    $(document).ready(function()
    {
    
        $.ajax({
          type: 'POST',
          url: '<?php echo $path."msgs/write";?>',
          data:{msg_type:"<?php echo $actions=='index'?"message":"sys";?>"},
          success: function(data){
                $( "#write_msg_div" ).empty();
               $( "#write_msg_div" ).html(data);
                  
            }
        });  
    
    
        $( "#write_msg_div" ).dialog({
            autoOpen: false,
            show: "drop",
            hide: "drop",
            height:"520",
            width:"800",
            
            title: "发送<?php echo $actions=='system_msg'?'系统消息':'消息'; ?>",
       
             create: function( event, ui ) {

               // $("[name='users[]']:hidden").remove();
               // $("[name='user_list[]']:checkbox").attr("checked",false);
                
            }
        });  
        
        
        
        $("#write_msg").click(function(){
        
            
            
            
            $( "#write_msg_div" ).dialog("open");  
            

        });
        $(".show_receiver").click(function(){
        
           if($("#receiver").height()==20){
                $("#receiver").css({height:"auto"});
           }else{
                $("#receiver").css({height:"20px"});
           }
            

        });
        
    
        var scollSettings = {
            showArrows: false,
            autoReinitialise: true
        };
        var pane = $('.right_side_scollbar_msg');
        pane.jScrollPane(scollSettings);
        var contentPane = pane.data('jsp').getContentPane();
        
        var leftPanel = $(".left_side_menu_panel");
        leftPanel.jScrollPane(scollSettings);
        var leftContentPanel = leftPanel.data('jsp').getContentPane();
        <?php if($this->action=="edittalent"){?>
            $(":file").uniform();
            $("#CompanyTalmenu").uniform();
            $("#CompTalentDeclarateStatus").uniform();
        <?php }else{?>
            $(":file, :checkbox, :radio, select").uniform();
        <?php }?>
        <?php if($this->name=="Searchs" && ($this->action=="talentdb" || $this->action=="index" || $this->action=="allfinace")){?>
            $("div.selector").css("width","120px");
            $("div.selector span").css("width","90px");
            $("div.selector select").css("min-width","126px");
            
        <?php }?>
        <?php if($this->name=="Projects" && $this->action=="index"){?>
            $("div.selector").css("width","130px");
            $("div.selector span").css("width","100px");
            $("div.selector select").css("min-width","136px");
        <?php }?>
    
        $(".left_side_menu_panel li li a[class='selected']").parent().parent().css("display","block");
        $(".left_side_menu_panel li li a[class='selected']").parent().parent().siblings().addClass("active");
        $(".left_side_menu_panel").find(".active").addClass("selected");
        if ($.browser.msie && ($.browser.version == "7.0")) {
            //$(".left_side_menu").css("margin-left","-270px");
           // $(".book_link").css("margin-left","-13px");
           // $(".list_user_name").css("margin-left","150px");
           // $(".admin_tag").css("margin-left","-190px");
         }
         else if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) {
             alert(2);
         }
    });
function hideReceiver(){
	$('.show_receiver').hide();
	var rec_height = $('#receiver').height();
	if(rec_height > 25){
		$('#receiver').css('height','20px');
		$('.show_receiver').show();
	}else{
		$('.show_receiver').hide();
	}
}
    
$(function(){
    var _wrap=$('ul.line');//定义滚动区域
    var _interval=3000;//定义滚动间隙时间
    var _moving;//需要清除的动画
    _wrap.hover(function(){
        clearInterval(_moving);//当鼠标在滚动区域中时,停止滚动
    },function(){
        _moving=setInterval(function(){
            var _field=_wrap.find('li:first');//此变量不可放置于函数起始处,li:first取值是变化的
            var _h=_field.height();//取得每次滚动高度(多行滚动情况下,此变量不可置于开始处,否则会有间隔时长延时)
            _field.animate({marginTop:-_h+'px'},600,function(){//通过取负margin值,隐藏第一行
                _field.css('marginTop',0).appendTo(_wrap);//隐藏后,将该行的margin值置零,并插入到最后,实现无缝滚动
            })
        },_interval)//滚动间隔时间取决于_interval
    }).trigger('mouseleave');//函数载入时,模拟执行mouseleave,即自动滚动
});
</script>
<!--[if lt IE 9]>
<?php echo $html->css('ie.css'); ?>
<?php echo $javascript->link('ie.js');?>
<?php echo $javascript->link('jquery.placeholder.js');?>
<![endif]-->
<title>
常熟领军人才
</title>
</head>
<body>
<?php echo $this->element('judgeexplorer');?>
<div style="display:none">
<?php echo $html->link("url","/",array("id"=>"getpath"))?>
<div id="gcontroller"><?php echo $controller; ?></div>
<div id="gaction"><?php echo $actions; ?></div>
</div>
<div class="whole_page">
        <!-- header -->
        <?php if(1==1){?>
        <div class="head_bg">
            <div class="head_content">
                <div class="h_c_left_bg left"></div>
                <div class="h_c_center_bg left">
                    <div class="logo_nav_area">
                        <div class="custp_logo left"><a href="<?php echo $path.'projects/index'; ?>"><?php echo $html->image('logo.png')?></a></div>
                        <div class="custp_site_info">
                            <div class="login_user_info">
                                <div class="left head_title">网上管理平台</div>
                 <div class="left user_welcome">欢迎&nbsp;
                                        <span>
                                        <?php if($cuser['cid']==""){
                                        	echo $html->link($cuser['name'],"/users/view/".$cuser['id']);
                                        }else{echo $cuser['name'];} ?>
										</span>
                                    </div>
                                <div id="addmessage" class="info_alert left"><?php $session->flash() ;?></div>
                                <div class="right user_welcome_logout">
                                    <div class="left top_menu_btn">
                                        <div class="left header_alert left">
                                            <div class="h_alert_n">
                                                <?php 
                                                    $urlpath= $path."msgs/index";
                                                    echo '<a title="站内信" href="'.$urlpath.'">';
                                                ?>
                                                    <div class="notification_icon left"></div>
                                                    <div id="p_m_alert_list" class="left">
                                                        <div id="p_m_l">
                                                            <div class="notification_num left" id="p_m_alert"></div>
                                                        </div>
                                                    </div>
                                                    <div class="clear"></div>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                   
                                    <div class="left user_logout"><?php echo $html->link(__('Exit',true), '/users/logout');?></div>
                                </div>
                                <div class='right' id='demo'>
                                <div class="notice_icon"></div>
                                <ul class='line'>
                                <?php foreach($notices as $notice):?>
                                    <li>
                                    	
                                    	<a  title="<?php echo $notice['Notice']['title'];?>" href='<?php echo $path.'notices/visit_view/'.$notice['Notice']['id']?>'>
                                    		<?php echo $str->sub_len($notice['Notice']['title'],15);?>
                                    	</a>
                                    </li>
                                   
                                    <?php endforeach;?>
                                    </ul>
                                </div>
                                <div class="clear"></div>
                            </div>
                            <?php echo $this->element('navigation',array('controller'=>$controller,'actions'=>$actions,'objmenu'=>$objmenu)) ?>
                        </div>
                    </div>
                </div>
                <div class="h_c_right_bg left"></div>
                <div class="clear"></div>
            </div>
        </div>
        <?php }?>
        <!-- content_operate -->

        <div class="app_content">
            <div class="app_panel">
                <div class="app_panel_pos_f">
                    <div class="app_panel_pos_s">
                 
                        <div class="left"></div>
                        <div class="left_side_menu left" style="width:263px;">
            <div class='app_menu_msg'>
                <ul style="margin:0;">
                    <li onclick="window.location.href='<?php echo $urlpath;?>'" style="margin:0;cursor:pointer;" <?php if($current_menu=='idx') echo "class='current'";?>><span href='<?php echo $urlpath;?>'>我的消息<?php echo '('.$unread_count; ?>)</span></li>
                    <li onclick="window.location.href='<?php echo $path."msgs/system_msg";?>'"  style="margin:0;cursor:pointer;" <?php if($current_menu=='sys') echo "class='current'";?>><span href='<?php echo $path."msgs/system_msg";?>'>系统消息(<?php echo $unread_sys_count ?>)</span></li>
                    <li onclick="window.location.href='<?php echo $path."msgs/outbox";?>'" style="margin:0;cursor:pointer;" <?php if($current_menu=='out') echo "class='current'";?>><span href='<?php echo $path."msgs/outbox";?>'>发件箱</span></li>
                   
                </ul>
           
            </div><!-- msg_btn end -->	
                <div class="clear"></div>            
             <div class="left_side_menu_panel" style="height:93%;margin-top:10px;">
                    <ul class='com_name' style="margin: 0px;">
                       <?php if(!empty($msgs)): ?>
                       <?php for($i=0;$i<count($msgs);$i++):?>
                        <li style="cursor:pointer;border-bottom:1px solid #eee;padding-top:8px;padding-left: 10px;" 
                            onclick="window.location.href='<?php echo $path.'msgs/'.$actions.'/'.$msgs[$i]['Msg']['id'];?>'" 
                            <?php if(!empty($this->params['pass'][0])){
                                    if(trim($this->params['pass'][0])==$msgs[$i]['Msg']['id']){
                                        echo "class='current'";
                                    }
                                  }else if($i==0){
                                    echo "class='current'";}?>>
                        <div class='left'><span class='left' style='height:60px;width:60px;'>
                        <?php echo $html->image('upm.jpg',array('width'=>'50','style'=>'border:1px solid #eee;'));?></span></div>
                        
                        <div style='width:170px;' class='left'>
                             <span ><?php echo $text->excerpt($msgs[$i]['User']['name'],'',4);?></span>
                             <?php 
                             	if ($actions != 'index'){
                             ?>
                             <span class='small right'><?php echo date('m-d',strtotime($msgs[$i]['Msg']['created']));?></span>
                             <?php 
                             	}
                             ?>
                        </div>
                        
                        <div style='margin-top:15px;width:170px;' class='left'>
                            <span ><?php echo $text->excerpt($msgs[$i]['Msg']['subject'],'',6);?></span>
                            <?php  if(!empty($msgs[$i]['istime']) && $msgs[$i]['istime']== '1'):?>
                            <span class='small right'><?php echo $html->image('time_run.png',array('width'=>'20','id'=>"timer_id",'style'=>'float: left;'));?></span>
                            <?php endif;?>
                            <?php  if(!empty($msgs[$i]['Msg']['feedback_count']) && $msgs[$i]['Msg']['feedback_count'] != '0'):?>
                            <span class='small right'><?php echo $msgs[$i]['Msg']['feedback_count'];?></span>
                            <?php endif;?>
                             </div>
                        </li>
                       <?php endfor;?>
                       <?php else: ?>
                        <div style='text-align:center;font-size:13pt;'>没有消息</div>  
                       <?php endif;?>
                    </ul>	
                            </div>
                
                        </div>
                       
                       <div class="book_link left"></div>
                       <div id="write_msg_div" style="border:1px solid #ccc;"></div>
                       
                       
                        <div class="right_side_details">
                        
                        <div class="clear"></div>
                            <?php echo $content_for_layout; ?>
                        </div>
                        <div class="clear"></div>
                    </div>
                <div class="clear"></div>
                </div>
            </div>
        </div>      
    </div>
    <!-- footer -->
        <div class="footer_nav_bar">
            <div class="footer_c_area">
                <?php 
                //如果是企业
                    if($cuser['cid'] || @$cuser['cgid']){
                        echo $this->element('footer');
                    }else{
                ?>
                <ul>
                    <?php 
                    $pselected="";
                    $cselected="";
                    $sselected="";
                    $rselected="";
                    $gselected="";
                    $collselected = "";
                    if($controller == 'Projects'){ 
                        $pselected="selected";
                    }
                    else if($controller == 'Companys'){ 
                        $cselected="selected";
                    }else if($controller == 'Searchs'){ 
                        $sselected="selected";
                    }else if($controller == 'Reports'){ 
                        $rselected="selected";
                    }else if($controller == 'Colleages'){ 
                        $collselected="selected";
                    }else if($controller == 'Types' || $controller == 'Users' || $controller == 'Groups'){
                        $gselected="selected";
                    }
                    
                    $projectpath="/projects/index";
                    $companypath="/companys/index";
                    $searchpath="/searchs/index";
                    $reportpath="/reports/allindustry";
                    $colleagepath="/colleages/index";
                    $grouppath="/users/index";
                    $emptypath="javascript:void(0)";
                    if($cuser['cid'] || @$cuser['cgid']){
                        $projectpath=$emptypath;
                        $companypath=$emptypath;
                        $searchpath=$emptypath;
                        $grouppath=$emptypath;
                        $reportpath=$emptypath;
                        $colleagepath=$emptypath;
                        $cssnone="display";
                        $pselected=$sselected=
                        $rselected=$gselected=
                        $collselected=$cselected=$cssnone;
                    }
                    ?>
                    <?php 
//                    $flag=$action->checkPermissions($cuser,"add");
                    
                    //if($flag){?>
                    <!-- <li class="<?php echo $pselected?>"><?php echo $html->link('<span class="bottom_bar_item_intro_icon"></span><span class="bottom_icon_title">'.__("projects",true).'</span>',$projectpath,array('escape' => false))?></li> -->
                    <?php //}?>
                    
                    <li class="<?php echo $cselected?>"><?php echo $html->link('<span class="bottom_bar_item_data_icon"></span><span class="bottom_icon_title">'.__("companys",true).'</span>',$companypath,array('escape' => false))?></li>
                    <li class="<?php echo $sselected?>"><?php echo $html->link('<span class="bottom_bar_item_screen_icon"></span><span class="bottom_icon_title">'.__("searchs",true).'</span>',$searchpath,array('escape' => false))?></li>
                    <li class="<?php echo $rselected?>"><?php echo $html->link('<span class="bottom_bar_report_center_icon"></span><span class="bottom_icon_title">'.__("reports",true).'</span>',$reportpath,array('escape' => false))?></li>
                    <li class="display"><?php echo $html->link('<span class="bottom_bar_tech_trans_icon"></span><span class="bottom_icon_title">'.__("colleages",true).'</span>',$colleagepath,array('escape' => false))?></li>
                    <?php //if($cuser['isadmin']=='1'){
                       
?>
 <li class="<?php echo $gselected?>"><?php echo $html->link('<span class="bottom_bar_settings_icon"></span><span class="bottom_icon_title">'.__("users",true).'</span>',$grouppath,array('escape' => false))?></li>   
<?php
                        
                    //}?>
                   
                </ul><div class="clear"></div>
                <?php }?>
            </div>
        </div>
</body>
</html>
<?php echo $javascript->link('app.js');?>
<script>
messagefadeout();
var webpath=$("#getpath").attr('href');
setInterval("showTime()", 5000);
function showTime(){
   // getdata();
}

function getdata(){
    var uid="<?php echo $cuser['id'];?>";
    var urlpath=webpath+'projects/prompt/'+uid+'?r='+Math.random();
    $.ajax({     	   
        url: urlpath, 
        success:function(data){
            if(data=="-"){
                location.href=webpath;
            }
            var array=data.split(",");
            var alt=array[0];
            if(alt>99){alt="99+";}
            if(alt!="0")
            {
                $("#p_m_alert").css('display','block');
                $("#p_m_alert").html(alt);
            }
            var msg=array[1];
            if(msg>99){msg="99+";}
            if(msg!="0")
            {
                $("#n_m_alert").css('display','block');
                $("#n_m_alert").html(msg);
            }
        }
    });
}

function tst(){
$("#n_m_alert").css('display','none');
} 

function change_current(obj){
    //alert(obj.childNodes[3].childNodes[1].getAttribute("class"));
}


</script>